package wec_wallet.ebo.com.activity.options;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import bassproject.ebo.com.ebobass.activity.MyBaseActivity;
import bassproject.ebo.com.ebobass.utils.Pub;
import bassproject.ebo.com.ebobass.utils.StringUtil;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import wec_wallet.ebo.com.R;

public class ServiceContactActivity extends MyBaseActivity {
    @BindView(R.id.actionbar_back)
    RelativeLayout actionbar_back;
    @BindView(R.id.tv_service_tel)
    TextView tv_service_tel;
    @BindView(R.id.tv_service_email)
    TextView tv_service_email;
    String customer_service, email_service;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_service_contact);
        ButterKnife.bind(this);
        initViews();

    }

    @Override
    public void initViews() {
        Intent intent = getIntent();
        customer_service = intent.getStringExtra("tel");
        email_service = intent.getStringExtra("email");
        tv_service_tel.setText(customer_service);
        tv_service_email.setText(email_service);
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            onClick_Back();
            return false;
        }
        return super.onKeyDown(keyCode, event);
    }


    //返回键
    @OnClick(R.id.actionbar_back)
    void onClick_Back() {
        finish();
    }

    //打电话
    @OnClick(R.id.tv_service_tel)
    void onClickTel() {
        if (!StringUtil.isEmpty(customer_service)) {
            Pub.call(customer_service, false);
        }
    }

    @OnClick(R.id.tv_service_email)
    void onClickEmail() {
        if (!StringUtil.isEmpty(email_service)) {
            Pub.onClickCopy(email_service, getResources().getString(R.string.copy_success)) ;
        }
    }

    @Override
    public void onClick(View view) {

    }
}
